FROM hub.c.163.com/library/php:7.1-fpm

# Install modules
RUN apt-get update && apt-get install -y \
        git \
        curl \
        openssl \
        wget \
        vim \
        supervisor \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libpng12-dev \
        libicu-dev \
        libpcre3 \
        libpcre3-dev \
             --no-install-recommends

#install extension
RUN docker-php-ext-install mcrypt intl mbstring pdo_mysql pcntl zip

#install gd
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install gd

#install swoole
RUN pecl install swoole-2.0.7 &&  docker-php-ext-enable swoole

# Install composer && global asset plugin
ENV COMPOSER_HOME /root/.composer
ENV PATH /root/.composer/vendor/bin:$PATH
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Install redis 
RUN pecl install redis-3.1.4 &&  docker-php-ext-enable redis


RUN apt-get purge -y g++ \
    && apt-get autoremove -y \
    && rm -r /var/lib/apt/lists/* \
    && rm -rf /tmp/*

RUN usermod -u 1000 www-data

RUN cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

ENTRYPOINT /usr/bin/supervisord